<template>
  <!-- 这里是整个应用的根容器 -->
  <router-view />
</template>

<script setup>
// 这里可以放置全局的初始化逻辑
import { onMounted } from 'vue'
import { useRouter } from 'vue-router'

const router = useRouter()
import {useUserStore} from "@/stores/index.js";
const userStore = useUserStore()
// 示例：全局初始化逻辑
onMounted(() => {
  // 可以在这里添加全局路由守卫
  router.beforeEach((to, from, next) => {
    // 权限检查
    if(!userStore.isLogin && to.name != 'Login'){
      next({name:'Login'})
    }else{
      next()
    }
  })
})
</script>

<style>
/* 全局样式 */
#app {
  font-family: 'Helvetica Neue', Helvetica, 'PingFang SC', 'Hiragino Sans GB',
  'Microsoft YaHei', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: #2c3e50;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* 重置一些默认样式 */
body, html {
  margin: 0;
  padding: 0;
  height: 100%;
}

/* Element Plus 组件全局样式覆盖 */
.el-menu {
  border-right: none !important;
}

/* 全局过渡动画 */
.fade-enter-active,
.fade-leave-active {
  transition: opacity 0.3s ease;
}

.fade-enter-from,
.fade-leave-to {
  opacity: 0;
}
</style>